package com.kayo.specimen.model;

import java.io.Serializable;

public class JsonResult implements Serializable {
    public static int STATUS_SUCCESS = 0;
    public static int STATUS_ERROR = -1;
    public static int STATUS_LOGOUT = 1001;
    private int code;
    private String message;
    private Object data;

    public JsonResult(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public JsonResult() {
    }

    public JsonResult(int code) {
        this.code = code;
    }

    public JsonResult(int code, Object data) {
        this.code = code;
        this.data = data;
    }

    public JsonResult(int code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static JsonResult success(){
        return new JsonResult(STATUS_SUCCESS);
    }

    public static JsonResult success(Object data) {
        return new JsonResult(STATUS_SUCCESS, data);
    }

    public static JsonResult error(String message) {
        return new JsonResult(STATUS_ERROR, message);
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
